namespace EasyGo.App_Start 
{
    using System.Web;
    using System.Web.Http;
    using System.Web.Mvc;
    using EasyGo.Authentication;
    using EasyGo.Common.Auth;
    using EasyGo.Data;
    using EasyGo.DependencyResolution;
    using EasyGo.Logic;
    using StructureMap;

    public static class StructuremapMvc 
    {
        public static void Start()
        {
            DataConfigurator.Configure();
            LogicConfigurator.Configure();
            ObjectFactory.Configure((container) => container.For<IAuthenticationService>().Singleton().Use<AuthenticationService>());
            EasyGoPrincipal.SetResolver(() => HttpContext.Current.User as EasyGoPrincipal);
            DependencyResolver.SetResolver(new StructureMapDependencyResolver(ObjectFactory.Container));
            GlobalConfiguration.Configuration.DependencyResolver =
                new StructureMapDependencyResolver(ObjectFactory.Container);
        }
    }
}